<?php


namespace app\controller\v1;


use app\model\WelfareLog;
use think\facade\Db;
use think\Request;

/**
 * 公益环保
 * Class Welfare
 * @package app\controller\v1
 */
class Welfare
{

    /**
     * Welfare constructor.
     * @param \app\model\Welfare $welfare
     */
    public function __construct(\app\model\Welfare $welfare)
    {
        $this->model = $welfare;
    }


    /**
     * 公益环保列表
     * @param Request $request
     * @return mixed
     * @throws \think\db\exception\DataNotFoundException
     * @throws \think\db\exception\DbException
     * @throws \think\db\exception\ModelNotFoundException
     */
    public function WelfareList(Request $request)
    {
        return $this->model->list($request->data);
    }

    /**
     * 公益进度
     * @param Request $request
     * @return mixed
     * @throws \think\db\exception\DataNotFoundException
     * @throws \think\db\exception\DbException
     * @throws \think\db\exception\ModelNotFoundException
     */
    public function WelfareSchedule(Request $request)
    {

        return $this->model->WelfareSchedule($request->data['id']);

    }


    /**
     * 机构下项目
     * @param Request $request
     * @return mixed
     */
    public function InstitutionalProject(Request $request)
    {
        return $this->model->InstitutionalProject($request->data);
    }


    /**
     * 日志
     * @param Request $request
     * @return mixed
     * @throws \think\db\exception\DataNotFoundException
     * @throws \think\db\exception\DbException
     * @throws \think\db\exception\ModelNotFoundException
     */
    public function WelfareLog(Request $request)
    {
        return $this->model->log($request->data);
    }


    /**
     * 捐赠
     * @param Request $request
     * @param WelfareLog $welfareLog
     * @return mixed
     * @throws \think\db\exception\DataNotFoundException
     * @throws \think\db\exception\DbException
     * @throws \think\db\exception\ModelNotFoundException
     */
    public function Donate(Request $request, WelfareLog $welfareLog)
    {
        return $this->model->Donate($request, $welfareLog);
    }


    /**
     * 我的公益
     * @param Request $request
     * @return mixed
     */
    public function MyWelfare(Request $request)
    {
        return $this->model->MyWelfare($request->data);
    }
}